package com.xzx.study.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * @author xinzhixuan
 * @version V1.0
 * @date 2019/3/26 20:36
 */
public class BlackListDBHelper extends SQLiteOpenHelper {
    private static final String TAG = BlackListDBHelper.class.getSimpleName();

    public BlackListDBHelper(Context context) {
        super(context, "black_list.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.i(TAG, "========创建数据库");
        String sql = "create table black_list(_id integer primary key autoincrement, number varchar)";
        db.execSQL(sql);
        sql = "insert into black_list(number) values('111')";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.i(TAG, "=======数据库更新");
    }

    public interface BlackListTable {
        String TABLE_NAME = "black_list";
        interface Columns {
            String ID ="_id";
            String NUMBER = "number";
        }
    }
}
